const http = require('http');
const fs = require('fs');
const path = require('path');
const mime = require('mime');

http.createServer((req, res) => {
    console.log('代码服务器发送的：', req.headers);
    console.log('代码服务器发送的：', req.url);
    
    fs.readFile(path.join(__dirname, 'pages', req.url), 'utf-8', (err, data) => {
        // res.setHeader('content-type', mime.getType(req.url));
        res.end(data);
    });

   

}).listen(8888, () => { console.log('http://localhost:8888/index.html 服务器已启动') });